FROM node:20-alpine AS build

WORKDIR /var/www

COPY . .

ARG VITE_DOCS_BASEPATH
ARG VITE_DOCS_EXAMPLES_REACT_PATH
ARG VITE_DOCS_EXAMPLES_VUE_PATH
ARG ENVIRONMENT

ENV NUXT_DOCS_BASEPATH=$VITE_DOCS_BASEPATH
ENV NUXT_APP_BASE_URL=$VITE_DOCS_BASEPATH
ENV NUXT_DOCS_EXAMPLES_REACT_PATH=$VITE_DOCS_EXAMPLES_REACT_PATH
ENV NUXT_DOCS_EXAMPLES_VUE_PATH=$VITE_DOCS_EXAMPLES_VUE_PATH
ENV ENVIRONMENT=$ENVIRONMENT

RUN yarn
RUN ENV_NAME=$ENVIRONMENT yarn build:replace-assets-url-with
RUN yarn build:vue
RUN yarn build:docs

WORKDIR /var/www/apps/docs/components

CMD ["yarn", "serve"]

